package com.jlpay.openapi.demo.openmerch.change;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.SettleType;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.request.SettleAccountChangeRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.response.SettleAccountChangeResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 商户结算账户信息修改
 * @author chenjunhong
 * @date 2024/4/15
 */
public class SettleAccountChangeService {
    private static final Logger LOGGER = LoggerFactory.getLogger(SettleAccountChangeService.class);

    public static void main(String[] args) {
        SettleAccountChangeRequest settleAccountChangeRequest = buildSettleAccountChangeRequest();
        SettleAccountChangeResponse settleAccountChangeResponse = JlpayOpenApiService.openMerchWithCryptoService()
                .post(settleAccountChangeRequest, SettleAccountChangeResponse.class);
        LOGGER.info("商户结算账户修改响应:{}", JsonUtils.toString(settleAccountChangeResponse));
    }

    private static SettleAccountChangeRequest buildSettleAccountChangeRequest() {
        SettleAccountChangeRequest settleAccountChangeRequest = new SettleAccountChangeRequest();
        // 商户号
        settleAccountChangeRequest.setMerchNo("849584358140108");
        // 业务申请编号
        settleAccountChangeRequest.setApplyId("b8659ea518d14c99b78b5ad000a4155a");
        // 结算类型
        settleAccountChangeRequest.setSettleType(SettleType.TO_CORPORATE_ACCOUNT);
        // 结算账号
        settleAccountChangeRequest.setAccountNo("替换为银行卡");
        // 结算账名
        settleAccountChangeRequest.setAccountName("王二");
        // 结算账户照片
        settleAccountChangeRequest.setAccountPic("region-ali-oss://jlpay-test/managefile/2024/02/28/1709106666879_6c53af86b9654680a727b92795dce6c2.jpg");
        // 开户支行编号
        settleAccountChangeRequest.setBankBranchId("105584000370");
        // 开户支行名称
        settleAccountChangeRequest.setBankBranchName("中国建设银行股份有限公司深圳罗湖支行");
        return settleAccountChangeRequest;
    }
}
